Ext.define('DragonApp.view.resource.Tag', {
    extend: 'DragonApp.view.foundation.ImgGrid',

    alias: ['widget.taggrid'],

    controller: 'resource',

    selModel: {
        selType: 'checkboxmodel'
    },
    requires: [
        'DragonApp.store.Tag',
        'DragonApp.util.File',
        'DragonApp.util.String',
        'DragonApp.view.resource.Bar'
    ],
    dockedItems: [{
        xtype: 'resource-bar',
        dock: 'top'
    }],
    columns: [
        { text: '序号', xtype: 'rownumberer', width: 70, align: 'center' },
        { text: '文件名称', dataIndex: 'filename', width: 150, align: 'center' },
        { text: '标签', dataIndex: 'tag', width: 70, align: 'center' },
        { text: '类型', dataIndex: 'ext', width: 100, align: 'center' },
        { text: '大小', dataIndex: 'filesize', width: 100, align: 'center', renderer: DragonApp.util.File.bytesToSize },
        { text: '宽度', dataIndex: 'width', width: 100, align: 'center', hidden: true },
        { text: '高度', dataIndex: 'height', width: 100, align: 'center', hidden: true },
        { text: '修改时间', dataIndex: 'lastmodtime', width: 145, align: 'center' },
        { text: '文件路径', dataIndex: 'path', flex: 1, align: 'center', renderer: DragonApp.util.String.contentRender }
    ],

    store: {
        type: 'tagStore',
        storeId: 'tagStore'
    },
    initComponent: function() {

        var me = this;
        me.callParent(arguments);

        var newBtn = me.queryById('new');
        var deleteColumn = me.queryById('delete');
        var batDeleteBtn = me.queryById('batdelete');
        //========
        //权限控制
        //========
        if ('查询用户' == sessionStorage.getItem("DragonApp_role_name")) {
            newBtn.hide();
            deleteColumn.hide();
            batDeleteBtn.hide();
        }
    }
});